
import java.util.Random;
import java.util.Scanner;

/*
 * @className HomeWorkFour
 * @description
 * @author admin
 * @date 2022/3/11 14:16
 * */
public class HomeWorkFour {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入班级人数: ");
        int cs = sc.nextInt();
        //定义变长数组
        int[] arr = new int[cs];
        //利用随机数产生0-100的成绩为每个学生赋值(包含0和100)
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new Random().nextInt(101);
        }
        //定义一个统计不及格人数变量count 和 累加所有成绩的变量sum
        int count = 0, sum = 0;
        for (int i = 0; i < arr.length; i++) {
            //累加所有成绩
            sum += arr[i];
            if (arr[i] < 60) {
                count++;
            }
        }
        System.out.println("不及格人数: " + count + "\n班级平均分: " + (double) sum / cs);
    }
}
